All Questions
21 questions
1vote
0answers
68views
gtar recursively untar but leave in top directory
I am trying to recursively untar a whole lot of directories that have .tar files in them, but without creating any new subdirectories. I am successfully able to do one at a time with this command gtar ...
0votes
3answers
1kviews
Script to keep the latest 5 files and rest will be moved to other destination
Source path: /var/log/ Here I have 4 folders named ad1nrld,ad2nrld,icp1rmnrl,icp2rmnrl I can move all the files to the other destination named /home/spsy/logs_bkp. But I want to keep latest 5 files in ...
0votes
1answer
3kviews
sending csv file via unix
I am sending an email with content, subject and attachment on a Solaris system. Some users are receiving the mail ok with CSV file and everything, and some users are receiving a content in base64 ...
2votes
0answers
24views
Script configuration issues
My purpose is to allow user A to run a specific script owned by user B but with user B’s profile loaded. This is on a Solaris maachine. I have users A and B, I set this line: in the sudoers file, so ...
0votes
1answer
476views
intelligent way to read another file for words to exclude while reading logs
I want to have a separate text file which I can modify anytime for words to be excluded while grepping the logs file. I have written below basic script to serve my purpose as of now. in SunOS. Please ...
1vote
5answers
734views
IF construct in Solaris box to compare hh:mm:ss
I had created the below script which does the comparison between hh:mm:ss format variables. #!/bin/sh lag=00:00:00 MAX_LAG=00:05:00 echo $lag echo $MAX_LAG if [ "$lag" \< "$MAX_LAG" ] ##if [ "$...
1vote
4answers
3kviews
Variable in Date command
I want to use a variable inside date command . GNU date is not supportable in my system. I use Sunos and when I use date with -d option it is shwoing -d as bad substitution. #!/usr/bin/ksh ...
1vote
1answer
332views
Pass variables from SHELL to AWK
I want to write a one liner on Solaris 11 to check the space in each of the zpools of my systems. The output would look like this... myzone1 rpool 83% myzone2 rpool 49% All the posts I've read say to ...
0votes
1answer
169views
Filtering time using last command on Solaris
I'm connected on server using Solaris and need to filter only people who were connected there until 28.4 00:00. How do I do that on Solaris? In bash I have -t option which does what I want.
2votes
1answer
499views
What does eval X=\$$i mean in UNIX?
I have a small script with the following lines echo mom,dad |awk -F, '{print $1,$2}' | while read VAR1 VAR2 do for i in VAR1 VAR2 do eval X=\$$i echo $X done done OUTPUT: mom dad What is ...
3votes
1answer
4kviews
How to kill inactive user logins on Solaris?
On a Solaris 10 server if i do a w, I get this: 12:26pm up 85 day(s), 1:13, 6 users, load average: 0.38, 0.36, 0.38 User tty login@ idle JCPU PCPU what blah pts/1 ...
0votes
2answers
154views
Unable to perform a simple multiplication in script
I am havingf trouble performing a simple multiplication in my script. while read A B C do tmp=$A\*$C/100 echo $tmp >> out1.txt done < foo.txt foo.txt: 13721725 99 100 ...
5votes
2answers
255views
Solaris: PKG - Script To Verify All Packages Except for a Few
I'm trying to verify the all packages except for a pre-defined list of packages that I know are going to fail for known reasons. This script is going to be run on all Solaris systems within our ...
-2votes
2answers
6kviews
Parsing a flat file using shell script
I have a file like in following format User:blala Pass:blala IP:***.***.**.** I tried with IFS but it is not working input="/path/to/your/input/file.cvs" while IFS=',' read -r f1 f2 f3 f4 f5 f6 ...
-1votes
1answer
132views
Command output to file, new lines at beginning
I'm rewriting some 20+ year old Unix scripts and I want the output to go to the screen and a file. I know this is possible with tee. Is there a similar command that stacks new lines on top, at the ...